
<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-title">
                <h5>渠道管理</h5>
            </div>
            <div class="ibox-content">
                <a class="menuid btn btn-primary btn-sm m-b-xs" href="javascript:location.reload();"><i
                            class="fa fa-refresh"></i> 刷新</a>
                <a href="<?php echo e(route('channels.create')); ?>" link-url="javascript:void(0)">
                    <button class="btn btn-primary btn-sm m-b-xs" type="button"><i class="fa fa-plus-circle"></i> 添加渠道
                    </button>
                </a>
                <form method="get" action="<?php echo e(route('channels.index')); ?>" name="form">
                    <?php echo csrf_field(); ?>


                    <table class="table-striped table-bordered table-hover table-condensed">
                        <tr>
                            <th style="min-width: 108px;">
                                <label>游戏&nbsp;&nbsp;</label>
                            </th>
                            <td class="b-child">
                                <div style="max-height:6.5rem;overflow-y:scroll;">
                                    <?php echo $__env->make('widget.game_radio', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th style="min-width: 108px;">
                            </th>
                            <td>
                                <?php echo $__env->make('widget.query_and_refresh', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            </td>
                        </tr>
                    </table>
                    <input type="hidden" name="page_size" value="<?php echo e($reqPageSize); ?>"/>
                </form>

                <table class="table table-striped table-bordered table-hover m-t-md">
                    <thead>
                    <tr>
                        <th class="text-center" width="100">ID</th>
                        <th class="text-center" width="100">游戏ID</th>
                        <th class="text-center" width="100">游戏名称</th>
                        <th class="text-center" width="100">渠道ID</th>
                        <th class="text-center">渠道名称</th>
                        <th class="text-center">服务器IP</th>
                        <th class="text-center">服务器端口</th>
                        <th class="text-center" width="80">状态</th>
                        <th class="text-center" width="150">创建时间</th>
                        <th class="text-center" width="150">修改时间</th>
                        <th class="text-center" width="200">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php $__currentLoopData = $channels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td class="text-center"><?php echo e($item->id); ?></td>
                            <td class="text-center"><?php echo e($item->game_id); ?></td>
                            <td class="text-center"><?php echo e($item->game->game_name); ?></td>
                            <td class="text-center"><?php echo e($item->channel_id); ?></td>
                            <td class="text-center"><?php echo e($item->channel_name); ?></td>
                            <td class="text-center"><?php echo e($item->server_ip); ?></td>
                            <td class="text-center"><?php echo e($item->port); ?></td>
                            <td class="text-center">
                                <?php if($item->status == 1): ?>
                                    <span class="text-navy">正常</span>
                                <?php elseif($item->status == 2): ?>
                                    <span class="text-danger">锁定</span>
                                <?php endif; ?>
                            </td>
                            <td class="text-center"><?php echo e($item->created_at->diffForHumans()); ?></td>
                            <td class="text-center"><?php echo e($item->updated_at->diffForHumans()); ?></td>

                            <td class="text-center">
                                <div class="btn-group">
                                    <a href="<?php echo e(route('channels.edit',$item->id)); ?>">
                                        <button class="btn btn-primary btn-xs" type="button"><i
                                                    class="fa fa-paste"></i> 修改
                                        </button>
                                    </a>
                                    <?php if($item->status == 2): ?>
                                        <a href="<?php echo e(route('channels.status',['status'=>1,'id'=>$item->id])); ?>">
                                            <button class="btn btn-info btn-xs" type="button"><i
                                                        class="fa fa-warning"></i> 恢复
                                            </button>
                                        </a>
                                    <?php else: ?>
                                        <a href="<?php echo e(route('channels.status',['status'=>2,'id'=>$item->id])); ?>">
                                            <button class="btn btn-warning btn-xs" type="button"><i
                                                        class="fa fa-warning"></i> 禁用
                                            </button>
                                        </a>
                                    <?php endif; ?>
                                    <a href="<?php echo e(route('channels.delete',$item->id)); ?>"
                                       onclick="if (!confirm('确定要删除吗?删除后无法撤销!'))return false;">
                                        <button class="btn btn-danger btn-xs" type="button"><i
                                                    class="fa fa-trash-o"></i> 删除
                                        </button>
                                    </a>
                                </div>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
                <div class="pull-left pagination m-t-no">
                    <?php echo $__env->make('widget.page',['reqPageSize'=>$reqPageSize], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                </div>
                <div class="pull-right pagination m-t-no">
                    <div class="text-center">
                        <?php
                        if (count($channels) > 0) {
                            echo $channels->appends(
                                [
                                    'game_id' => app('request')->input('game_id'),
                                    'page_size' => app('request')->input('page_size'),
                                ])->links();
                        }
                        ?>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script src="<?php echo e(loadEdition('/js/global.js')); ?>"></script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>